package com.aplink.generic.constant.type;

import android.text.InputType;

/**
 * @author Le Hien Nguyen.
 * @SeeMore: 
 *           http://developer.android.com/reference/android/widget/TextView.html#
 *           attr_android:inputType
 */
public enum EditTextType {
	DECIMAL("numberDecimal", InputType.TYPE_NUMBER_FLAG_DECIMAL
	        | InputType.TYPE_CLASS_NUMBER),
	EMAIL("textEmail", InputType.TYPE_CLASS_TEXT
	        | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS),
	NUMBER("number", InputType.TYPE_CLASS_NUMBER),
	PASSWORD("textPassword", InputType.TYPE_CLASS_TEXT
	        | InputType.TYPE_TEXT_VARIATION_PASSWORD),
	PHONE("phone", InputType.TYPE_CLASS_PHONE),
	TEXT("text", InputType.TYPE_CLASS_TEXT),
	TEXT_CAP_CHARACTERS(
	        "textCapCharacters",
	        InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS | InputType.TYPE_CLASS_TEXT),
	TEXT_CAP_WORDS("textCapWords", InputType.TYPE_TEXT_FLAG_CAP_WORDS
	        | InputType.TYPE_CLASS_TEXT);

	public static EditTextType get(final String name) {
		for (final EditTextType inputType : EditTextType.values()) {
			if (inputType.mName.equalsIgnoreCase(name)) {
				return inputType;
			}
		}
		return TEXT;
	}

	private String mName;

	private int mValue;

	private EditTextType(final String name, final int value) {
		this.mValue = value;
		this.mName = name;
	}

	public String getName() {
		return this.mName;
	}

	public int getValue() {
		return this.mValue;
	}

	public void setName(final String name) {
		this.mName = name;
	}

	public void setValue(final int value) {
		this.mValue = value;
	}

}
